﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Entities;

/// <summary>
/// Summary description for CustomerManager
/// </summary>
public class CustomerManager
{
    private CustomerData data;
    public CustomerManager()
    {
        data = new CustomerData();
    }
    public bool AddNewCustomer(Customer cus)
    {
        return data.AddNewCustomer(cus);
    }

    public Customer getCustomer()
    {
        return data.getCustomer();
    }

    public void AddOrder()
    {
        data.AddOrder();
    }

    public void AddNewOrder(Order or)
    {
        data.AddNewOrder(or);
    }

    public void AddNewOrderDetail(Dictionary<Product, int> dic, int orderID)
    {
        foreach (KeyValuePair<Product, int> item in dic)
        {
            OrderDetail orderDetail = new OrderDetail();
            orderDetail.ProductID = item.Key.ProductID;
            orderDetail.OrderId = orderID;
            orderDetail.Quantity = item.Value;
            orderDetail.Price = item.Key.ProductPrice;
            data.AddNewOrderDetail(orderDetail);
        }
    }
}